//
//  YPObject.m
//  ChengHuiTong
//
//  Created by KiVen on 15/11/5.
//  Copyright © 2015年 张文权. All rights reserved.
//

#import "YPObject.h"

@implementation YPObject
- (instancetype)initWithDictionary:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [[dic allKeys] enumerateObjectsUsingBlock:^(NSString *obj, NSUInteger idx, BOOL *stop) {
            if ([self respondsToSelector:NSSelectorFromString(obj)]){
                id value = [dic valueForKey:obj];
                if ([value isKindOfClass:[NSNull class]]) {
                    value = @"";
                }
                [self setValue:value forKey:obj];
                
                [self setValuesForKeysWithDictionary:dic];

            }
        }];
        
    }
    return self;
}
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
    
    
    
}
@end
